<?php

namespace App\Models\CacheModel\chat;

use App\Models\Api\BaseCache;

class HzChatRecordDetailsReport extends BaseCache
{
    protected $table = 'wechat_backup_07_18_14_43_00.hz_chat_record_details_report';

    /**
     * 设置 赞同与反对
     * @param int $uid
     * @param int $chatDetailId
     * @param string $reportReason 举报原因
     * @param int $chatType
     * @return bool
     */
    public function setReport(int $uid, int $chatDetailId, string $reportReason, int $chatType = 1)
    {
        try
        {
            $this->insertGetId([
                'uid' => $uid,
                'type' => $chatType,
                'chat_detail_id' => $chatDetailId,
                'reason' => $reportReason,
                'create_time' => time(),
            ]);

            return true;
        }
        catch (\Exception $e)
        {
            \think\Log::write(__CLASS__ . ' => ' . __FUNCTION__ . '()异常：' . $e->getMessage() . '失败信息：' . $e->getFile() . ':' . $e->getLine(), 'error', true);
            return false;
        }
    }
}
